package day6Exer;

public class Demo1 {
    public static void main(String[] args) {
    Circle shape = new Circle();
    shape.r = 10;
    System.out.println("半径为10的圆的面积为"+shape.Area());
    Rectangle shape1 = new Rectangle();
    shape1.h = 5;
    shape1.w = 3;
        System.out.println("高为5宽为3的矩形的面积为"+shape1.Area());


    }





}
abstract class Shape {
    public abstract double Area();
}

class Circle extends Shape {
        public double r;
        public double Pi = 3.1415926;
    void Circle(){
        this.r = r;
    }
        @Override
    public double Area() {
            return Pi * r * r;

    }
}

class Rectangle extends Shape {
            int h, w;
        public void Rectangle1(){
            this.h = h;
            this.w = w;
        }
        @Override
    public   double Area() {
            return h*w;
    }
}

